<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<script type="text/javascript" src="../js/angular.min.js" ></script>
		<title>angularJs事件绑定</title>
	</head>
	<body ng-app="appAngular" ng-controller="appController">
		<input type="text" ng-model="name" />
		<input type="button" value="清空" ng-click="clear()" /><br />
		
		<!-- 只是演示,真想清空可以这样 
			
		<input type="button" value="简单清空" ng-click="name=''" />
		-->
		Hello,{{name}}
		
		<script>
			// 初始化angular
			var myAngular = angular.module("appAngular",[]);
			
			// 初始化控制器
			myAngular.controller("appController",function($scope){
				$scope.name="白马程序员";
				
				// 控制这个方法
				$scope.clear = function(){
					alert($scope.name);
					alert("清空");
					$scope.name="";
				}
			});
			
			
			
		</script>
	</body>
</html>
